<?php
namespace App\Services;

use App\Models\Ad;

/**
 *
 * 广告服务层
 *
 * @author maqu
 *
 */
class SearchService extends BaseService {

    //获取主页轮播图
    /**
     *获取主页轮播图
     *
     * @param $count  轮播图显示个数
     */
    public function getHomePageCarousels($count){

        //本此系统暂无ad_positon等表，固值定死
        $advertise_info = Ad::where('owner_id',0)
            ->where('sys_id',1)
            ->where('page_id',1)
            ->where('position',1)
            ->where('if_show',1)
            ->orderBy('sort_order','asc')->skip(0)->take($count)
            ->get();

        foreach($advertise_info as $item){
            $item->pic_url = complete_url($item->pic_url);
        }

        return $advertise_info->toArray();

    }

}